package com.example.demo.controller;


import com.example.demo.dao.SaleMapper;
import com.example.demo.entity.CommonResult;
import com.example.demo.entity.Salesrecord;
import com.example.demo.service.SalesrecordService;
import io.swagger.annotations.ApiOperation;
import io.swagger.annotations.ApiParam;
import lombok.extern.slf4j.Slf4j;
import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.web.bind.annotation.*;

@RestController
@Slf4j
public class SaleDrugsController {

    @Autowired
    SalesrecordService salesrecordService;
    @PostMapping("/Drugs/addSale")
    @ResponseBody
    @ApiOperation(notes = "销售添加", value = "addSale")
    public CommonResult addSale(@ApiParam(name = "添加销售药品信息，相当于购买",required = true) @RequestBody Salesrecord salesrecord){
        CommonResult commonResult =salesrecordService.addSalesrecord(salesrecord);
        return commonResult;
    }

    @PostMapping("/Drugs/return_drugs")
    @ResponseBody
    @ApiOperation(notes = "退货", value = "return_drugs")
    public CommonResult return_drugs(@ApiParam(name = "退货",required = true) @RequestBody Salesrecord salesrecord){
        CommonResult commonResult =salesrecordService.addReturn_drugs(salesrecord);
        return commonResult;
    }

}
